4. Connecting with SQL Server Management Studio
Follow these steps to connect to your SQL Azure database using SQL Server Management Studio:
You need to obtain the fully qualified server name of the SQL Azure database. Figure 7
shows the server information on the SQL Azure portal. The fully
qualified server name is located above the Reset Password button.
NOTE
This example uses SQL
Server 2008 SP1 Management Studio. Although you can connect to and
manage SQL Azure using this release, additional features are available
using the SQL Server 2008 R2 release, such as the ability to view
database objects using the Object Browser.
Start SQL Server Management Studio. Click the Cancel button in the Login screen.
NOTE
If you're using SQL Server
Management Studio for SQL Server 2008 R2, you can log in using the
first Login window. However, if you're using a previous version of SQL
Server Management Studio, you need to click Cancel in the first Login
window. The instructions provided in this section work for both
editions.
Click the New Query button, or press Ctrl + N. A new Login screen opens (see Figure 8). In this window, enter the following information:
Server name. Enter the fully qualified server name.
Authentication. Select SQL Server Authentication.
Login. Type the administrator username (created previously).
Password. Type the password of the administrator account.
By default,
clicking Connect authenticates you against the master database. If you
want to connect to another database, click Options and type the desired
database name in the "Connect to database" field, as shown in Figure 9. Note that you can't select the database name; the database name must be typed.
When you're ready, click Connect. A new query window opens, and you can execute T-SQL commands against your SQL Azure database.
NOTE
After you connect to a
database, the only way to use another database is to re-establish a
connection and type the database name in the "Connect to database"
field. The USE command doesn't work
against SQL Azure to switch database contexts. Because a database can
be physically located on any server, the only practical way to switch
databases is to reconnect.
Figure 10 shows the query window connected to SQL Azure, on which a simple command has been executed.